﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

//输入一行字符串，分别统计出其中英文字母、数字、空格的个数。
namespace ConsoleApp1
{
    class Four
    {
        static void Main(string[] args) {
            string str = "ihyuui 415  5";
            int ZiMuShu = 0;
            int ShuZiShu = 0;
            int KongGeShu = 0;
            foreach (char c in str) {
                if (char.IsWhiteSpace(c))
                {
                    KongGeShu++;
                }
                else if (char.IsLetter(c))
                {
                    ZiMuShu++;
                }
                else if (char.IsDigit(c)) {
                    ShuZiShu++;
                }
            }
            Console.WriteLine("字符串中，数字有{0}个，字母有{1}个，空格有{2}个", ShuZiShu, ZiMuShu, KongGeShu);
        }
    }
}
